const { ethers } = require("hardhat")

/**
 *
 * @dev 不使用hardhat Deploy管理的部署合约方法 也可以参考
 */
async function getTestContract() {
    const test = await (await ethers.getContractFactory("test")).deploy()
    return test
}

async function main() {
    const test = await getTestContract()

    const callfunc = await (
        await ethers.getContractFactory("callfunc")
    ).deploy(test.address)

    console.log(
        await callfunc.callFuncWithBin(
            test.address,
            ethers.utils.parseEther("0.01")
        )
    )

    console.log(await test.s_address(), (await test.s_amount()).toString())
}

main()
    .then(() => process.exit(0))
    .catch((e) => {
        console.warn(e)
        process.exit(1)
    })
